package com.spooky.sync.note.model;

import java.util.LinkedList;
import java.util.List;
import com.spooky.sync.persistence.entity.Note;
import com.spooky.sync.persistence.entity.Tag;

public class EditorStorage {
	private static EditorStorage mEditorStatus = null;
	private boolean mShowingEditTitle;
	private int mSelectedCategory;
	protected Note mNote = null;
	private List<Tag> mTag = null;

	private EditorStorage() {
		setShowingEditTitle(false);
		mSelectedCategory = 0;
	}

	public static EditorStorage getInstance() {
		if (mEditorStatus == null) {
			mEditorStatus = new EditorStorage();
		}
		return mEditorStatus;
	}

	public static EditorStorage newInstance() {
		return mEditorStatus = new EditorStorage();
	}

	public static void resetInstance() {
		mEditorStatus = null;
	}

	public void setShowingEditTitle(boolean showingEditTitle) {
		mShowingEditTitle = showingEditTitle;
	}

	public boolean isShowingEditTitle() {
		return mShowingEditTitle;
	}

	public void setSelectedCategory(int selectedCategory) {
		mSelectedCategory = selectedCategory;
	}

	public int getSelectedCategory() {
		return mSelectedCategory;
	}

	public Note getNote() {
		if (mNote == null) {
			mNote = new Note();
		}
		return mNote;
	}

	public void setNote(Note note) {
		mNote = note;
	}

	public List<Tag> getTag() {
		if (mTag == null) {
			mTag = new LinkedList<Tag>();
		}
		return mTag;
	}

	public void setTag(List<Tag> tag) {
		mTag = tag;
	}
}
